export default function migrate(project) {
    let r = Object.assign({}, project);
    r.tests = r.tests.map((test) => {
        return Object.assign({}, test, {
            commands: test.commands.map((c) => {
                let newCmd = Object.assign({}, c);
                if (c.command === 'waitForVisible' || c.command === 'waitForEditable') {
                    newCmd.command = migrateCommand(newCmd.command);
                    return newCmd;
                } else {
                    return c;
                }
            }),
        });
    });
    return r;
}

function migrateCommand(command) {
    return command.replace(/waitFor/g, 'waitForElement');
}

migrate.version = '1.1';
